package com.asus.api;

import java.util.HashMap;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class UpdateRegApi extends ApiBase
{

	public UpdateRegApi(HashMap<String, String> pHashMap)
	{
		super(
				"https://vip.asus.com/webservice/app_cusinfo.asmx/UpdRegProfile?",
				pHashMap);
	}
	
	private HashMap<String, String> mHashMap =  new HashMap<String, String>();

	public Boolean Start()
	{
		if (Run())
		{
			try
			{

				NodeList _List = mRootElement.getElementsByTagName("ASUS");

				for (int i = 0; i < _List.getLength(); i++)
				{
					mHashMap = new HashMap<String, String>();
					for (int j = 0; j < _List.item(i).getChildNodes()
							.getLength(); j++)
					{
						Node _Node = _List.item(i).getChildNodes().item(j);
						if (_List.item(i).getChildNodes().item(j).getNodeName() == "#text")
						{
						} else
						{
							mHashMap.put(_Node.getNodeName(),
									_Node.getTextContent());
						}
					}
				}

				return true;

			} catch (Exception e)
			{
				e.printStackTrace();
				return false;
			}
		}
		return false;
	}

	public HashMap<String, String> getHashMap()
	{
		return mHashMap;
	}

}
